package com.one.tank;

import java.util.Random;

public class RandomNumberMap {
    public static byte[][] generateRandomArray(int rows, int cols, int minVal) {
        byte[][] array = new byte[rows][cols];
        Random random = new Random();

        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                //array[i][j] = (byte) (random.nextInt(maxVal - minVal + 1) + minVal);
                int randomNumber = random.nextInt(3);
                if (randomNumber == 0) {
                    array[i][j] = 0;
                } else {
                    array[i][j] = (byte) (randomNumber - 1 + minVal);
                }
            }
        }
        return array;
    }
    public static void printArray(byte[][] array) {
        System.out.println("{");
        for (int i = 0; i < array.length; i++) {
            System.out.print("    {");
            for (int j = 0; j < array[0].length; j++) {
                System.out.print(array[i][j]);
                if (j != array[0].length - 1) {
                    System.out.print(", ");
                }
            }
            System.out.print("}");
            if (i != array.length - 1) {
                System.out.println(",");
            } else {
                System.out.println();
            }
        }
        System.out.println("}");
    }
    public static void main(String[] args) {
        int rows = 26;
        int cols = 26;
        int minVal = 0;

        byte[][] randomArray = generateRandomArray(rows, cols, minVal);
        printArray(randomArray);
    }
}
